#ifndef HZ_disp_functionsH
#define HZ_disp_functionsH

#include <R.h>
#include <Rinternals.h>

#include <Rmath.h>

//------------------------------------------------------------------------------
//Global variables
ind *cur_ind = NULL; //current set of individuals
ind *new_ind = NULL; //next generation of individuals
Grid **grid = NULL;  //grid to store pop. size

int popsize; //population size
double K, lambda;
//------------------------------------------------------------------------------
typedef struct{
	int x_coord;
	int y_coord;
	double hybrid_index;
	double mean_negexI; //2 alleles for mean dispersal distance (negative exponential)
	double mean_negexII;

}ind;
//------------------------------------------------------------------------------
typedef struct{
	int N; //number of adults
	int newN; //number of offspring

	int *ind_index; //array to store the indexes of the inds that are in each cell
}Grid;

//Functions
void initialise (int n, int intial_col, int xDim, int yDim);
void mate_selection(int ii, int xx, int yy)
void reproduce(void);
void disperse(void);




#endif
